package br.ufpe.cin.rgms.util;

import org.hibernate.Session;
import org.hibernate.SessionFactory;
import org.hibernate.cfg.AnnotationConfiguration;


public class HibernateUtil {

	private static Session session;

	public static Session getSession() {

		if (session == null) {
			AnnotationConfiguration configuration = new AnnotationConfiguration();
			configuration.configure();

			SessionFactory factory = configuration.buildSessionFactory();
			session = factory.openSession();
		}
		return session;
	}

}
